package com.jackykeke.opengldemo

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.jackykeke.opengldemo.camera.CameraSurfaceActivity
import com.jackykeke.opengldemo.circle.CircleActivity
import com.jackykeke.opengldemo.circle.ConeActivity
import com.jackykeke.opengldemo.cube.IndicesCubeRendererActivity
import com.jackykeke.opengldemo.cube.LineCubeRendererActivity
import com.jackykeke.opengldemo.function.*
import com.jackykeke.opengldemo.texture2d.TextureRendererActivity
import com.jackykeke.opengldemo.texture2d.TextureRendererOrthogonalProjectionActivity

class MainActivity : AppCompatActivity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        init()
    }


    private fun init() {
        //我们为其设置版本好为2
//        glSurfaceView.setEGLContextClientVersion(2)
//
////        为其设置Render，这个才是控制渲染的地方
//
//        glSurfaceView.setRenderer(renderer)
    }

    fun blackFilter(view: View) {
        startActivity(
            Intent(
                this,
                RendererActivity::class.java
            )
        )
    }

    fun graphicsFilter(view: View) {
        startActivity(
            Intent(
                this,
                GraphicsActivity::class.java
            )
        )

    }

    fun coloredTriangleFilter(view: View) {

        startActivity(
            Intent(
                this,
                ColoredTriangleActivity::class.java
            )
        )

    }

    fun rectangleFilter(view: View) {

        startActivity(
            Intent(
                this,
                RectangleActivity::class.java
            )
        )
    }

    fun vboDrawTriangle(view: View) {

        startActivity(
            Intent(
                this,
                VboDrawTriangleActivity::class.java
            )
        )
    }

    fun vaoDrawTriangle(view: View) {
        startActivity(
            Intent(
                this,
                VaoDrawTriangleActivity::class.java
            )
        )

    }

    fun lineCube(view: View) {
        startActivity(
            Intent(
                this,
                LineCubeRendererActivity::class.java
            )
        )
    }


    fun indicesCube(view: View) {
        startActivity(
            Intent(
                this,
                IndicesCubeRendererActivity::class.java
            )
        )
    }


    fun textureRenderer(view: View) {
        startActivity(
            Intent(
                this,
                TextureRendererActivity::class.java
            )
        )
    }


    fun textureRendererOrthogonalProjection(view: View) {
        startActivity(
            Intent(
                this,
                TextureRendererOrthogonalProjectionActivity::class.java
            )
        )
    }

//    CameraSurfaceActivity

    fun textureRendererCameraSurfaceActivity(view: View) {
        startActivity(
            Intent(
                this,
                CameraSurfaceActivity::class.java
            )
        )
    }


    fun testCircleActivity(view: View) {
        startActivity(
            Intent(
                this,
                CircleActivity::class.java
            )
        )
    }


    fun testConeActivity(view: View) {
        startActivity(
            Intent(
                this,
                ConeActivity::class.java
            )
        )
    }


    fun testNdkOpenGLActivity(view: View) {
        startActivity(
            Intent(
                this,
                NdkOpenGLActivity::class.java
            )
        )
    }
}